package top.huhuiyu.springboot3.p2301.controller.auth;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.huhuiyu.springboot3.p2301.base.R;
import top.huhuiyu.springboot3.p2301.entity.auth.TbUser;
import top.huhuiyu.springboot3.p2301.service.auth.AuthService;

@RestController
@RequiredArgsConstructor
@RequestMapping("/auth")
public class AuthController {
    private final AuthService authService;

    @PostMapping("/reg")
    public R<TbUser> reg(@RequestBody TbUser tbUser) {
        return authService.reg(tbUser);
    }

    @PostMapping("")
    public R<TbUser> login(@RequestBody TbUser tbUser) {
        return authService.login(tbUser);
    }

    @GetMapping("")
    public R<TbUser> info() {
        return authService.info();
    }

    @DeleteMapping("")
    public R<String> logout() {
        return authService.logout();
    }


}
